package com.wk.code.wkserver.controller.admin;

import com.wk.code.wkserver.entity.SysIgnorePath;
import com.wk.code.wkserver.request.admin.SysIgnorePathRequest;
import com.wk.code.wkserver.response.base.PageInfo;
import com.wk.code.wkserver.response.result.R;
import com.wk.code.wkserver.service.ISysIgnorePathService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author: wangqiang
 * @create: 2021-08-20 13:48
 */
@RestController
@RequestMapping("admin/ignorePath")
@Api(tags = "admin-系统放行路径")
public class AdminIgnorePathController {

    @Resource
    private ISysIgnorePathService sysIgnorePathService;


    /**
     * 分页列表
     *
     * @param request request
     * @return R
     */
    @ApiOperation(value = "系统放行路径分页列表")
    @PostMapping("/page")
    public R<PageInfo<SysIgnorePath>> page(@RequestBody SysIgnorePathRequest request) {
        return R.success(sysIgnorePathService.page(request));
    }


    /**
     * 添加
     *
     * @param req 请求参数
     * @return R
     */
    @ApiOperation(value = "添加")
    @PostMapping("/add")
    public R<Void> add(@RequestBody SysIgnorePathRequest req) {
        sysIgnorePathService.add(req);
        return R.success();
    }

    /**
     * 删除
     *
     * @param id ID
     * @return R
     */
    @ApiOperation(value = "删除")
    @GetMapping("/delete")
    private R<Void> delete(Integer id) {
        sysIgnorePathService.delete(id);
        return R.success();
    }
}
